package com.neusoft.meal.controller;

import com.neusoft.meal.po.ClientMealPreferences;
import com.neusoft.meal.po.ResponseBean;
import com.neusoft.meal.service.ClientMealPreferencesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
//@CrossOrigin("*")
@RequestMapping("/ClientMealPreferencesController")
public class ClientMealPreferencesController {

    @Autowired
    private ClientMealPreferencesService clientMealPreferencesService;

    @GetMapping("/getAllClientMealPreferences")
//    查看客户日常膳食配置
    public ResponseBean<List<ClientMealPreferences>> getAllClientMealPreferences() {
        return clientMealPreferencesService.getAllClientMealPreferences();
    }

    @GetMapping("/{id}")
    public ResponseBean<ClientMealPreferences> getClientMealPreferencesById(@PathVariable Integer id) {
        return clientMealPreferencesService.getClientMealPreferencesById(id);
    }

    @PostMapping("/addClientMealPreferences")
//    客户日常膳食配置
    public ResponseBean<Integer> addClientMealPreferences(@RequestBody ClientMealPreferences clientMealPreferences) {
        return clientMealPreferencesService.addClientMealPreferences(clientMealPreferences);
    }

    @PutMapping("/updateClientMealPreferences")
//    修改膳食配置
    public ResponseBean<Integer> updateClientMealPreferences(@RequestBody ClientMealPreferences clientMealPreferences) {
        return clientMealPreferencesService.updateClientMealPreferences(clientMealPreferences);
    }

    @DeleteMapping("/{id}")
    public ResponseBean<Integer> deleteClientMealPreferences(@PathVariable Integer id) {
        return clientMealPreferencesService.deleteClientMealPreferences(id);
    }
}